<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/js/axios.js"></script>
</head>
<body>
    <script>
        axios({
            method:'GET',
            url: 'http://www.liulongbin.top:3006/api/get',
            params : {name:'pink',age:20},
        }).then(function(res) {
            // console.log(res);
            console.log(res.data);
        })
        // 唯一的区别就是提交数据时:get在params里提交/post在data里提交 
        // 响应回来的数据通过.then回调函数
        axios({
            method:'POST',
            url: 'http://www.liulongbin.top:3006/api/post',
            data : {name:'pink',age:20},
        }).then(function(res) {
            // console.log(res);
            console.log(res.data);
        })
    </script>
</body>
</html>